import 'package:flutter/cupertino.dart';

import '../model/counter_provider.dart';

class CounterDisplay extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    // 使用 CounterProvider.of(context) 获取最近的 CounterProvider 实例
    final provider = CounterProvider.of(context);
    final count = provider?.count ?? 0;

    return Text(
      '当前计数: $count',
      style: const TextStyle(fontSize: 24),
    );
  }
}
